<?php
/**
 *  公司设置控制器 
 */
namespace app\admin\controller;
use app\admin\model\Company as CompanyModel;

class Company extends Common
{
    private $model;
    public function _initialize()
    {
		parent::_initialize();
        $this->model = new CompanyModel();
    }

    // 显示公司设置
    public function index()
    {
        // 获取公司配置
        $this->assign('companys', $this->model->getList());
        return $this->fetch();
    }

    // 修改公司设置
    public function mod()
    {
		if(!$this->request->isPost()){
            return;
        }
		$UrlParam=input();
        $data = array(
            'name' => $UrlParam['name'],
            'address' => $UrlParam['address'],
            'postcode' => $UrlParam['postcode'],
            'contact' => $UrlParam['contact'],
            'mobile' => $UrlParam['mobile'],
            'phone' => $UrlParam['phone'],
            'fax' => $UrlParam['fax'],
            'email' => $UrlParam['email'],
            'qq' => $UrlParam['qq'],
            'weixin' => $UrlParam['weixin'],
			'weixin2' => $UrlParam['weixin2'],
			'weixin3' => $UrlParam['weixin3'],
            //'blicense' => $UrlParam['blicense'],
           // 'other' => $UrlParam['other']
        );
		if ($this->model->modCompany($data)) {
			$this->success('修改成功！');
		} else {
			$this->error('修改失败！');
		}
    }
}